package org.btik.light.server.platform.common.api.bean.user;

import org.btik.light.cache.CurrentMemCachePo;
import org.springframework.beans.BeanUtils;

import java.util.Date;

/**
 * @author lustre
 * @since 2023/6/11 15:39
 */
public class User implements CurrentMemCachePo<User> {
    private String username;

    private String account;

    private String password;

    private String remark;

    private Date creatTime;

    private Date updateTime;

    private Date lastLoginTime;

    private String lastLoginIp;

    private int failedCount;

    private long lockTime;

    private boolean locked = false;

    private boolean enable = true;
    private boolean admin = false;

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getAccount() {
        return account;
    }

    public void setAccount(String account) {
        this.account = account;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public boolean getEnable() {
        return enable;
    }

    public void setEnable(boolean enable) {
        this.enable = enable;
    }

    @Override
    public String key() {
        return getAccount();
    }

    @Override
    public void setKey(String key) {
        setAccount(key);
    }

    @Override
    public User copy(User po) {
        BeanUtils.copyProperties(po, this);
        return this;
    }

    @Override
    public User newCopy() {
        User user = new User();
        BeanUtils.copyProperties(this, user);
        return user;
    }

    public Date getCreatTime() {
        return creatTime;
    }

    public void setCreatTime(Date creatTime) {
        this.creatTime = creatTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public Date getLastLoginTime() {
        return lastLoginTime;
    }

    public void setLastLoginTime(Date lastLoginTime) {
        this.lastLoginTime = lastLoginTime;
    }

    public String getLastLoginIp() {
        return lastLoginIp;
    }

    public void setLastLoginIp(String lastLoginIp) {
        this.lastLoginIp = lastLoginIp;
    }

    public long getLockTime() {
        return lockTime;
    }

    public void setLockTime(long lockTime) {
        this.lockTime = lockTime;
    }

    public boolean isLocked() {
        return locked;
    }

    public void setLocked(boolean locked) {
        this.locked = locked;
    }

    public boolean isEnable() {
        return enable;
    }

    public int getFailedCount() {
        return failedCount;
    }

    public void setFailedCount(int failedCount) {
        this.failedCount = failedCount;
    }

    public boolean isAdmin() {
        return admin;
    }

    public void setAdmin(boolean admin) {
        this.admin = admin;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }
}
